<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <!-- <hr> -->
  <!-- <hr> -->
  <div id="app" style="color: yellow;background: black;">
    <h1 style="color:yellow">这是一个h1标签</h1>hello, {{name}}
    <span>年龄：{{age}}</span>
    <span>兴趣: {{hobbies}}</span>
  </div>
  <script src="/dist/umd/vue.js"></script>
  <script>
    // 问题1： 通过vm新增的data属性无法被监视

    let vm = new Vue({
      el: "#app",
      data() {
        return {
          name: "vue",
          age: {
            age: 19
          },
          lessonInfo: {
            title: "shuxue",
            price: 188
          },
          hobbies: ["basketball", 'football']
        }
        // return null;
      },
      beforeCreate() {
        console.log("我的自定义beforecreate");
      },
      created() {
        console.log("我的数据定义好了", this.$el);
      },
      beforeMount() {
        // console.log(this);
        console.log("我要挂载东西了", this.$el);
      },
      mounted() {
        // console.log(this);
        console.log("东西挂载好了", this.$el);
      }
    })
    console.log(vm);
    setTimeout(() => {
      vm.name = "kdjfkdj"; // 依赖收集
      vm.hobbies.push(1)
      vm.hobbies.push(2)
      vm.hobbies.push(3)
      // vm._update(vm._render())
      // 希望数据变化可以自动的重新执行我们的渲染watcher
    }, 1000)
  </script>
</body>

</html>